#ifndef _CSDLINPUTHANDLER_H
#define _CSDLINPUTHANDLER_H

#include "../src/ErrorOutputs.h"
#include "../Objects/CLivingObject.h"
#include "../Graphics/ConfigStructs.h"
#include <../../SDL/include/SDL/SDL.h>

class CSDLInputHandler
{
public:
	CSDLInputHandler(LivingObject *pPlayer, KeyMapping *keyMapping);
	~CSDLInputHandler();

private:
	void processKeyUp(SDL_Event *m_evSDLEvent);
	void processKeyDown(SDL_Event *m_evSDLEvent);
	void processMouseUp(SDL_Event *m_evSDLEvent);
	void processMouseDown(SDL_Event *m_evSDLEvent);
	void processMouseMove(SDL_Event *m_evSDLEvent);
	void mapInputConfigToSDLEnum(KeyMapping *keyMapping);
        SDLKey getSDLEnum(std::string key);
	SDL_Event m_evSDLEvent;


public:
	bool checkEvents();
        void activateInput();
        void deactivateInput();

	bool m_bContinue;
	LivingObject *m_pPlayer;
	
	Ogre::Timer m_TimerFPS;
	Ogre::Timer m_TimerSecond;
	long m_lFrame;

private:
	struct SDLKeyMapping
	{
		SDLKey Forward;
		SDLKey Backward;
		SDLKey Up;
		SDLKey Down;
		SDLKey Left;
		SDLKey Right;
		SDLKey Run;
		SDLKey Menu;
	} m_keyTable;

        bool m_isInputActivated;
};


#endif //_CSDLINPUTHANDLER_H
